package lab02.test19;

import java.util.Scanner;

public class Test {
    // 编写一个程序，实现字符串的大小写转换并倒序输出，如输入为“HelloWord”，输出为“DROwOLLEH”。
        public static StringBuffer convertString(String str) {
            String upStr = str.toUpperCase();
            String lowStr = str.toLowerCase();

            StringBuffer buf = new StringBuffer(str.length());
            for (int i = 0, k = str.length(); i < k; i++) {
                {
                    if (str.charAt(i) == upStr.charAt(i)) {
                        buf.append(lowStr.charAt(i));
                    } else {
                        buf.append(upStr.charAt(i));
                    }
                }
            }
            return buf;
        }
    public static void main(String[] args) {
            String result;
        Scanner scanner=new Scanner(System.in);
        result=scanner.next();
        System.out.println(result);
        StringBuffer ss = convertString(result);
        System.out.println("将字符串进行大小写转换:" + convertString(result));
        System.out.println("将字符串倒序输出:" + ss.reverse());
    }


    }





